import java.io.IOException;


public class Main {
	public static void main (String[] args) throws IOException {
		System.out.println("Welcome in THECell Server:");
		java.io.DataInput in = new java.io.DataInputStream(System.in);
		System.out.println("Insert server port:");
		int port=0;
		try{
			port=Integer.parseInt(in.readLine());
		}
		catch (NumberFormatException e){
			System.out.println("Default port --> 4450");
			port=4450;
		}
		String pwd="";
		while(pwd.isEmpty()){
			System.out.println("Insert server password:");
			pwd=in.readLine();
			if(pwd.isEmpty())System.out.println("Empty Password Not Admitted!");
		}
	
		System.out.println("Server Started - Waiting for Request ...");
		if(pwd.isEmpty())new UdpServer(port).run();
		else new UdpServer(port, pwd).run();
	}
}
